package il.ac.tau.cvws.scrabblesidekick.server.util.file;

import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.Writer;

public class FileUtil 
{
	public static void deleteFile(String dir)
	{
		new File(dir).delete();	
	}
	
	public static void createDirectory(String dir)
	{
		new File(dir).mkdirs();
	}
	
	public static String[] getDirectoryFiles(String dir)
	{
		return new File(dir).list();
	}
	
	public static void writeToDirectory(File file, String dirPath)
	{
		try
		{
			Writer output = null;
			output = new BufferedWriter(new FileWriter(file));
			output.close();
		}
		catch(Exception e)
		{
			System.out.println("Could not create file");
		}
	}
}
